using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest.Entitys
{
    /// <summary>
    /// 库存记录，供应商分表
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='库存记录，供应商分表']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class StockLog
    {
        /// <summary>
        /// log_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[bigint NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary]
        public long LogId { get; set; }

        /// <summary>
        /// sku_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(32) NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(32, false)]
        public string SkuId { get; set; }

        /// <summary>
        /// 商品id
        /// </summary>
        /// <remarks>
        /// <![CDATA[bigint NOT NULL COMMENT '商品id']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("商品id")]
        public long GoodsId { get; set; }

        [JsonConverter(typeof(AutoEnumConverter))]
        public StockTypeEnum StockTypeName => (StockTypeEnum)StockType;

        /// <summary>
        /// 库存类型[初始化,出库,入库,盘点,销毁]
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '库存类型[初始化,出库,入库,盘点,销毁]']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("库存类型[初始化")]
        public int StockType { get; set; }

        /// <summary>
        /// 库存变动
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '库存变动']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("库存变动")]
        public int StockChange { get; set; }

        /// <summary>
        /// 已同步
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '已同步']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("已同步")]
        public bool IsSync { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        /// <remarks>
        /// <![CDATA[datetime NOT NULL COMMENT '创建日期']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("创建日期")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// create_date
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(false)]
        public int CreateDate { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '备注']]>
        /// </remarks>
        [Column(255)]
        [DisplayName("备注")]
        public string Remark { get; set; }

    }
}
